/**
 * Copyright (C) 2018-2021
 * All rights reserved, Designed By www.yixiang.co

 */
package co.yixiang.modules.product.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import co.yixiang.domain.BaseDomain;
import co.yixiang.modules.user.domain.YxUser;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import java.util.Date;

/**
* @author hupeng
* @date 2020-05-12
*/

@Data
@EqualsAndHashCode(callSuper = true)
@AllArgsConstructor
@NoArgsConstructor
@TableName("yx_store_product_reply")
public class YxStoreProductReply extends BaseDomain {

    /** 评论ID */
    @TableId
    private Long id;


    /** 用户ID */
    private Long uid;


    /** 订单ID */
    private Long oid;


    /** 唯一id */
    @TableField(value = "`unique`")
    private String unique;


    /** 产品id */
    private Long productId;


    /** 某种商品类型(普通商品、秒杀商品） */
    private String replyType;


    /** 商品分数 */
    private Integer productScore;


    /** 服务分数 */
    private Integer serviceScore;


    /** 评论内容 */
    private String comment;


    /** 评论图片 */
    private String pics;



    /** 管理员回复内容 */
    @NotBlank(message = "回复内容不能为空")
    private String merchantReplyContent;


    /** 管理员回复时间 */
    private Date merchantReplyTime;


    /** 0未回复1已回复 */
    private Integer isReply;

    @TableField(exist = false)
    private YxStoreProduct storeProduct;

    @TableField(exist = false)
    private YxUser user;

    public static YxStoreProductReplyBuilder builder() {
        return new YxStoreProductReplyBuilder();
    }

    public void copy(YxStoreProductReply source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }

    public static class YxStoreProductReplyBuilder {
        private Long id;
        private Long uid;
        private Long oid;
        private String unique;
        private Long productId;
        private String replyType;
        private Integer productScore;
        private Integer serviceScore;
        private String comment;
        private String pics;
        private @NotBlank(message = "回复内容不能为空") String merchantReplyContent;
        private Date merchantReplyTime;
        private Integer isReply;
        private YxStoreProduct storeProduct;
        private YxUser user;

        YxStoreProductReplyBuilder() {
        }

        public YxStoreProductReplyBuilder id(Long id) {
            this.id = id;
            return this;
        }

        public YxStoreProductReplyBuilder uid(Long uid) {
            this.uid = uid;
            return this;
        }

        public YxStoreProductReplyBuilder oid(Long oid) {
            this.oid = oid;
            return this;
        }

        public YxStoreProductReplyBuilder unique(String unique) {
            this.unique = unique;
            return this;
        }

        public YxStoreProductReplyBuilder productId(Long productId) {
            this.productId = productId;
            return this;
        }

        public YxStoreProductReplyBuilder replyType(String replyType) {
            this.replyType = replyType;
            return this;
        }

        public YxStoreProductReplyBuilder productScore(Integer productScore) {
            this.productScore = productScore;
            return this;
        }

        public YxStoreProductReplyBuilder serviceScore(Integer serviceScore) {
            this.serviceScore = serviceScore;
            return this;
        }

        public YxStoreProductReplyBuilder comment(String comment) {
            this.comment = comment;
            return this;
        }

        public YxStoreProductReplyBuilder pics(String pics) {
            this.pics = pics;
            return this;
        }

        public YxStoreProductReplyBuilder merchantReplyContent(@NotBlank(message = "回复内容不能为空") String merchantReplyContent) {
            this.merchantReplyContent = merchantReplyContent;
            return this;
        }

        public YxStoreProductReplyBuilder merchantReplyTime(Date merchantReplyTime) {
            this.merchantReplyTime = merchantReplyTime;
            return this;
        }

        public YxStoreProductReplyBuilder isReply(Integer isReply) {
            this.isReply = isReply;
            return this;
        }

        public YxStoreProductReplyBuilder storeProduct(YxStoreProduct storeProduct) {
            this.storeProduct = storeProduct;
            return this;
        }

        public YxStoreProductReplyBuilder user(YxUser user) {
            this.user = user;
            return this;
        }

        public YxStoreProductReply build() {
            return new YxStoreProductReply(id, uid, oid, unique, productId, replyType, productScore, serviceScore, comment, pics, merchantReplyContent, merchantReplyTime, isReply, storeProduct, user);
        }

        public String toString() {
            return "YxStoreProductReply.YxStoreProductReplyBuilder(id=" + this.id + ", uid=" + this.uid + ", oid=" + this.oid + ", unique=" + this.unique + ", productId=" + this.productId + ", replyType=" + this.replyType + ", productScore=" + this.productScore + ", serviceScore=" + this.serviceScore + ", comment=" + this.comment + ", pics=" + this.pics + ", merchantReplyContent=" + this.merchantReplyContent + ", merchantReplyTime=" + this.merchantReplyTime + ", isReply=" + this.isReply + ", storeProduct=" + this.storeProduct + ", user=" + this.user + ")";
        }
    }
}
